# -*- coding = utf-8 -*-
# Author：凌杰
# Email：577709198@qq.com
from django.utils.deprecation import MiddlewareMixin
from django.http import HttpResponse
from django.shortcuts import render


class TestMiddleWare(MiddlewareMixin):

    # def process_request(self, request):
    #     """请求前中间件"""
    #     print("111111111每次请求前都会调用执行")

        # username = request.COOKIES.get('name')
        # if username is None:
        #     print("没有用户信息")
        # else:
        #     print("有用户信息")

    def process_response(self, request, response):
        """响应前中间件"""
        print("111111111每次响应前都会调用执行")
        context = {
            'errmsg': '正在换脸中'
        }
        return render(request, 'result.html', context=context)

